﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace JM.JCY.SharePointComponent.Announcement.LeftMenuAnnounce
{
    public partial class LeftMenuAnnounceUserControl : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string sourceDirectory = this.Parent.AppRelativeTemplateSourceDirectory;    //Example:   ~/_CONTROLTEMPLATES/NCS.OCP.SharePointComponent.Broadcast/CreateBroadcastsRole/
            string webPartName = sourceDirectory.Substring(sourceDirectory.TrimEnd('/').LastIndexOf('/') + 1).TrimEnd('/');
            if (webPartName == "CreateAnnounce" || webPartName == "EditAnnounce" ||
                webPartName == "ManageAnnounce" || webPartName == "SearchAnnounce" || webPartName == "ViewAnnounceDetail")
            {
                this.lbAnnounceMgr.CssClass = "leftmenuSelected";
            }
        }
    }
}
